package com.hksj.slm.controller;


import com.hksj.common.core.model.Rest;
import com.hksj.slm.dto.LinkLightingDTO;
import com.hksj.slm.query.LinkLightingQuery;
import com.hksj.slm.service.LinkLightingService;
import com.hksj.slm.vo.LinkLightingVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;

@Api(tags = "智能照明-关联照明设备")
@RestController
@RequestMapping("/api/slm/linkLighting")
public class LinkLightingController {

    @Autowired
    private LinkLightingService linkLightingService;

    @ApiOperation(value = "新增照明设备关联")
    @PostMapping("/saveLinkLighting")
    public Rest<String> saveLinkLighting(@RequestBody @Valid LinkLightingDTO dto){
        return linkLightingService.saveLinkLighting(dto);
    }

//    @ApiOperation(value = "更新照明设备关联")
//    @PutMapping("/updateLinkLighting")
//    public Rest<String> updateLinkLighting(@RequestBody LinkLightingDTO dto){
//        return linkLightingService.updateLinkLighting(dto);
//    }

    @ApiOperation(value = "删除照明设备关联")
    @DeleteMapping("/deleteLinkLighting")
    public Rest<String> deleteLinkLighting(@RequestBody LinkLightingDTO dto){
        return linkLightingService.deleteLinkLighting(dto);
    }

    @ApiOperation(value = "查询关联照明设备关系列表")
    @PostMapping("/queryLinkLightingList")
    public Rest<List<LinkLightingVO>> queryLinkLightingList(@RequestBody LinkLightingQuery query){
        return Rest.ok(linkLightingService.queryLinkLightingList(query));
    }

    @ApiOperation(value = "查询开关回路设备列表")
    @PostMapping("/queryLightingModelList")
    public Rest<List<LinkLightingVO>> queryLightingModelList(@RequestBody LinkLightingQuery query){
        return Rest.ok(linkLightingService.queryLightingModelList(query));
    }

}
